<?php
include("init.php");
$file_exists = file_exists("Resources/install.lock") ? header("Location: ../index.php") : true;

switch( $_GET["stage"] )
{
	default:
	case '1':
		$smarty->assign("url", "http://" . $_SERVER['HTTP_HOST'] . str_replace("Install/install.php", "", $_SERVER['PHP_SELF'] ) );
		$smarty->assign("page", "step1");
		break;
}
switch( $_POST["stage"] )
{
	case '1':
		$database = array( "flat", "mysql" );
		echo $_POST["url"];
		if( in_array($_POST["database"], $database) && $_POST["url"] )
		{
			echo "HI";
			switch( $_POST["database"] )
			{
				case 'flat':
					header("Location: install.php?stage=3");
					echo "HI";
					break;
			}
		}
		break;
}
$display = $_POST["stage"] ? true : $smarty->display("index.tpl");
?>